<?php
// +----------------------------------------------------------------------
// | Exquisite
// +----------------------------------------------------------------------
// | Author: derek <693472824@qq.com> <http://www.bloveambition.com/>
// +----------------------------------------------------------------------

namespace Blovex4\Logic;

/**
 * 手机前端展示效果图业务逻辑
 *
 * @author derek <693472824@qq.com>
 */
class BannerLogic extends BaseLogic {

    /**
     * 保存信息
     *
     * @author derek <693472824@qq.com>
     */
    public function saveAction() {
        
        $bannerID = I('banner_id');
        $bannerModel = D('Banner');
        
        $data = I();
        
        if (empty($bannerID)) {
            $data['create_time'] = NOW_TIME;
            $data['admin_id'] = AdminLogic::is_login();
        }

        if ($bannerModel->create($data)) {
            
            if (empty($bannerID)) {
                
                return $bannerModel->add();
            } else {
                
                $map['banner_id'] = $bannerID;
                return $bannerModel->where($map)->save();
            }
        } else {
            
            $this->error = $bannerModel->getError();
            return false;
        }
    }
}

?>